<template>
    <div>
        <el-form-item label="文本名称">
            <el-input v-model="data.options.label"/>
        </el-form-item>
        <el-form-item label="密码长度">
            <el-input-number :min="4" v-model="data.options.length"/>
        </el-form-item>
        <el-form-item label="明文显示">
            <el-switch
                v-model="data.options.mask"
                active-text="隐藏"
                inactive-text="显示"/>
        </el-form-item>
    </div>
</template>
<script>
import { PasswordInput, NumberKeyboard } from 'vant'
export default {
    name: 'FormPassword',
    components: {
        [PasswordInput.name]: PasswordInput,
        [NumberKeyboard.name]: NumberKeyboard
    },
    props: {
        data: {
            type: Object
        }
    },
    data() {
        return {
            showKeyboard: false
        }
    },
    methods: {
        onInput(key) {
            this.data.options.defaultValue = (this.data.options.defaultValue + key).slice(0, 6)
        },
        onDelete() {
            this.data.options.defaultValue = this.data.options.defaultValue.slice(0, this.data.options.defaultValue.length - 1)
        }
    }
}
</script>
